package com.ft.oa.service.task.impl;

import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
import com.ft.oa.domain.development.DevNeedIssue;
import com.ft.oa.mapper.development.DevNeedIssueMapper;
import com.ft.oa.service.task.TaskService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * 研发分配（立项）审批驳回
 */
@Service("devNeedAllocateCallBackTask")
public class DevNeedAllocateCallBackTask implements TaskService {

    @Resource
    private DevNeedIssueMapper devNeedIssueMapper;


    @Override
    @Transactional
    public void exec(HashMap<String, Object> params) {

        LambdaUpdateChainWrapper<DevNeedIssue> wrapper = new LambdaUpdateChainWrapper<>(devNeedIssueMapper);
        boolean update = wrapper.eq(DevNeedIssue::getId, params.get("issueId"))
                .set(DevNeedIssue::getDataState, 0)
                .update();
    }
}
